﻿@using Webdiyer.WebControls.Mvc
@model Webdiyer.WebControls.Mvc.PagedList<WorkTimePrj.Models.vwItemProject>
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>工时更正</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <style type="text/css">
        body { color: #000000; }
        h2 { font-size: 10pt; font-family: simsun; background: #197B30; height: 35px; line-height: 35px; padding-left: 10px; color: #ffffff; font-weight: normal; }
        .WP_1 { width: 97%; margin: 15px auto; }
        .Btn01 { border: solid 1px #5381B3; color: #5381B3; }
        input[type='text'].TB01 { width: 135px; font-family: simsun; }
        table { border-collapse: collapse; margin: 15px 0; border: solid 1px #A5A5A5; }
        table tr th { background: #197B30; color: #ffffff; border-right: solid 1px #A5A5A5; border-bottom: solid 1px #A5A5A5; }
        table tr td { font-family: simsun; font-size: 12px; text-align: left; color: #000000; border-right: solid 1px #A5A5A5; border-bottom: solid 1px #A5A5A5; }
        .WP_2 { /*width:99.5%; margin:0 auto;*/ border: solid 1px #c0d6ef; padding: 15px 0 0 0; background: #e4ecf5; }
        .WP_2 div { padding-bottom: 10px; }
        .WP_2 div.WP_6 { padding-bottom: 0; }
        .WP_3 { width: 600px; text-align: left; margin: 0 auto; /*float:left;*/ }
        .Btn01 { border: solid 1px #5381B3; }
        .Label01 { color: #440e62; }
        .Label02 { color: #440e62; font-weight: bold; }
        .Text01 { width: 550px; }
        .WP_4 { float: left; padding-top: 5px; }
        .WP_5 { float: left; }
        .WP_6 { float: left; background: #440E62; color: #ffffff; margin-left: 5px; width: 15px; height: 15px; line-height: 15px; }
        .WP_7 { display: block; border: solid 1px #c0d6ef; background: #e4ecf5; margin-top: 15px; float: left; }
        .WP_8 { float: left; }
        .WP_9 { margin: 0 auto; width: 40px; }
        .WP_10 { margin: 0 auto; width: 70px; }
        .WP_11 { margin: 0 auto; width: 60px; }
        .Select { border: solid 1px #A5A5A5; font-family: simsun; }
        table tr th.Col1 { width: 115px; }
        table tr th.Col2 { width: 165px; }
        .Order { width: 8px; float: right; }
        .OrderUp { background: url(/WorkTimePrj/Content/Img/arrow_up_05.jpg) no-repeat; width: 8px; height: 4px; display: block; /*float:left;*/ margin-bottom: 5px; }
        .OrderDown { background: url(/WorkTimePrj/Content/Img/arrow_down_05.jpg) no-repeat; width: 8px; height: 4px; display: block; /*float:left;*/ }
        span.cpb { color: #338AA5; }
    </style>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/DatePicker/WdatePicker.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('.OrderUp').hover(function () {
                $(this).css({ 'cursor': 'pointer' });
            },
            function () {
                $(this).css({ 'cursor': 'default' });
            });
            $('.OrderDown').hover(function () {
                $(this).css({ 'cursor': 'pointer' });
            },
            function () {
                $(this).css({ 'cursor': 'default' });
            });

            $("#tblAll >tbody> tr > td > input[name^='cb']").each(function () {
                $(this).change(function () {
                    var length = $("#tblAll >tbody> tr > td > input[name^='cb']:checked").length;
                    var length2 = $("#tblAll >tbody> tr > td > input[name^='cb']").length;
                    if (length2 == length)
                        $("#cbAll").attr("checked", true);
                    else
                        $("#cbAll").attr("checked", false);

                });

            });
            $("#cbAll").click(function () {

                $("#tblAll >tbody> tr > td > input[name^='cb']").attr("checked", $("#cbAll").attr("checked"));

            });

        });
        function pickedFunc1() {
            var dayofwk = $dp.cal.getP('w');
            if (dayofwk != '01')
                alert('日期错误！只能选择星期一');
        }
        function doDelete() {
            var ids = '';
            $("#tblAll >tbody> tr > td > input[name^='cb']:checked").each(function () {
                ids += $(this).attr("id").substring(2, 38) + ',';

            });
            if (ids == '')
                alert('未选择');
            else {
                if (confirm('确认删除?')) {
                    $.ajax({
                        dataType: 'json',
                        url: '@Url.Content("~/Item/deleteitem")',
                        type: 'post',
                        data: { 'nc': Math.random(), ids: ids },
                        success: function (text) {

                            if (text == "0") {
                                alert('删除成功');
                                location.href = location.href;
                            }
                            else {
                                alert('删除失败');
                            }
                        },
                        error: function (e) {
                            alert(e.message);
                        }
                    });


                }

            }
        }
    </script>
</head>
<body>
    @using (Html.BeginForm(new { endTime = ViewBag.endTime, orderBy = ViewBag.orderBy }))
    {
        <div class="WP_1">
            <h2>
                工时更正 &nbsp;&nbsp;&nbsp;<span class="Lbl02">@ViewBag.startTime.ToString("yyyy-MM-dd")</span>
                至 <span class="Lbl02">@ViewBag.endTime.ToString("yyyy-MM-dd")</span>&nbsp;&nbsp;&nbsp;
                总计 @ViewBag.cnt 条</h2>
            <div>
                <label class="Lbl01">
                    姓名</label>&nbsp;&nbsp;&nbsp;@Html.DropDownList("uidSelectList", null, "---", new { @class = "Select" })
                <label class="Lbl01">
                    所属项目</label>&nbsp;&nbsp;&nbsp;@Html.DropDownList("pidSelectList", null, "---", new { @class = "Select" })
                <label class="Lbl01">
                    开始日期</label>&nbsp;&nbsp;&nbsp;<input id="TBStartTime" name="TBStartTime"  class="TB01" type="text" value="@ViewBag.startTime.ToString("yyyy-MM-dd")" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:pickedFunc1})"/>
                <input id="BtnSubmit" type="submit" class="Btn01" value="查询" />&nbsp;&nbsp;&nbsp;
                <input id="BtnAdd" type="button" class="Btn01" value="新增" onclick="window.open('/WorkTimePrj/Item/Create')" />&nbsp;&nbsp;&nbsp;
                <input id="BtnDelete" type="button" style="color: Red;" class="Btn01" value="删除"
                    onclick="doDelete()" />
            </div>
            @if (ViewBag.cnt != 0)
            {
                <table border="1" id="tblAll">
                    <tr>
                        <th class="Col1">
                            <div class="WP_9 g2roup">
                                <div class="WP_8">
                                    姓名</div>
                                <div class="Order group">
                                    <span class="OrderUp" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "User_DisplayName asc" })'">
                                    </span><span class="OrderDown" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "User_DisplayName desc" })'">
                                    </span>
                                </div>
                            </div>
                        </th>
                        <th class="Col2">
                            <div class="WP_10 group">
                                <div class="WP_8">
                                    所属项目</div>
                                <div class="Order group">
                                    <span class="OrderUp" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "Proj_Name asc" })'">
                                    </span><span class="OrderDown" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "Proj_Name desc" })'">
                                    </span>
                                </div>
                            </div>
                        </th>
                        <th>
                            <div class="WP_10 group">
                                <div class="WP_8">
                                    时间范围</div>
                                <div class="Order group">
                                    <span class="OrderUp" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "starttime asc" })'">
                                    </span><span class="OrderDown" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "starttime desc" })'">
                                    </span>
                                </div>
                            </div>
                        </th>
                        <th>
                            <div class="WP_10 group">
                                <div class="WP_8">
                                    工作时长</div>
                                <div class="Order group">
                                    <span class="OrderUp" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "cost asc" })'">
                                    </span><span class="OrderDown" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "cost desc" })'">
                                    </span>
                                </div>
                            </div>
                        </th>
                        <th>
                            <div class="WP_10 group">
                                <div class="WP_8">
                                    确认状态</div>
                                <div class="Order group">
                                    <span class="OrderUp" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "ack_type asc" })'">
                                    </span><span class="OrderDown" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "ack_type desc" })'">
                                    </span>
                                </div>
                            </div>
                        </th>
                        <th>
                            <div class="WP_11 group">
                                <div class="WP_8">
                                    满意度</div>
                                <div class="Order group">
                                    <span class="OrderUp" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "rate asc" })'">
                                    </span><span class="OrderDown" onclick="window.location.href='@Url.Action("List", new { id = 1, account = ViewBag.account, pid = ViewBag.pid, startTime = ViewBag.startTime, endTime = ViewBag.endTime, orderBy = "rate desc" })'">
                                    </span>
                                </div>
                            </div>
                        </th>
                        <th>
                            事项
                        </th>
                        <th>
                        </th>
                        <th width="60">
                            <input type="checkbox" id="cbAll" name="cbAll" /><label for="cbAll">全选</label>
                        </th>
                    </tr>
                    @{int i = 0;
                      foreach (var item in Model)
                      {
                          i = i + 1;
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.User_DisplayName)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Proj_Name)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.starttime)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.cost)
                            </td>
                            <td>
                                @if (item.ack != null)
                                {
                                    @Html.DisplayFor(modelItem => item.ack_type)
                                }
                                else
                                {
                                    <span>未确认</span>
                                }
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.rate)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.title)
                            </td>
                            <td>
                                <a href="#" class="Link" onclick="window.open('/WorkTimePrj/Item/Edit/@item.uid');">
                                    修改</a>
                            </td>
                            <td style="text-align: center">
                                <input type="checkbox" id="cb@(item.uid)" name="cb@(item.uid)"  />
                            </td>
                        </tr>
                      }
                    }
                </table>
        
                <div style="margin: 20px;">
                    @Html.Pager(Model, new Webdiyer.WebControls.Mvc.PagerOptions
{
    PageIndexParameterName = "id",
    CurrentPagerItemWrapperFormatString = "<span class=\"cpb\">{0}</span>",
    NumericPagerItemWrapperFormatString = "<span class=\"item\">{0}</span>"
})
                </div>
            }
            else
            {
                <span class="WP_7">无数据</span>
            }
        </div>
    }
    @Html.CommonnScript()
</body>
</html>
